home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 22 / CU Amiga Magazine's Super CD-ROM 22 (1998)(EMAP Images)(GB)[!][issue 1998-05].iso / PowerPC / Programming / PPCSmallEiffel / lib_se / creation_call_2.e < prev    next >
Encoding:
Text File  |  1998-01-16  |  2.4 KB  |  101 lines

  1. --          This file is part of SmallEiffel The GNU Eiffel Compiler.
  2. --          Copyright (C) 1994-98 LORIA - UHP - CRIN - INRIA - FRANCE
  3. --            Dominique COLNET and Suzanne COLLIN - colnet@loria.fr 
  4. --                       http://www.loria.fr/SmallEiffel
  5. -- SmallEiffel is  free  software;  you can  redistribute it and/or modify it 
  6. -- under the terms of the GNU General Public License as published by the Free
  7. -- Software  Foundation;  either  version  2, or (at your option)  any  later 
  8. -- version. SmallEiffel is distributed in the hope that it will be useful,but
  9. -- WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  10. -- or  FITNESS FOR A PARTICULAR PURPOSE.   See the GNU General Public License 
  11. -- for  more  details.  You  should  have  received a copy of the GNU General 
  12. -- Public  License  along  with  SmallEiffel;  see the file COPYING.  If not,
  13. -- write to the  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  14. -- Boston, MA 02111-1307, USA.
  15. --
  16. class CREATION_CALL_2
  17.    -- 
  18.    -- For creation call like : 
  19.    --                           !BAR!foo
  20.    --
  21.  
  22. inherit 
  23.    CREATION_CALL_1_2;
  24.    CREATION_CALL_2_4;
  25.  
  26. creation make
  27.    
  28. feature 
  29.    
  30.    make(sp: like start_position; t: like type; w: like writable) is
  31.       require
  32.      sp /= Void;
  33.      t /= Void;
  34.      w /= Void;
  35.       do
  36.      start_position := sp;
  37.      type := t;
  38.      writable := w;
  39.       end;
  40.    
  41.    compile_to_c is
  42.       do
  43.      if type.is_reference then
  44.         c2c_opening(type);
  45.         c2c_closing(type);
  46.      else
  47.         c2c_clear_expanded(type.id);
  48.      end;
  49.       end;
  50.    
  51.    compile_to_jvm is
  52.       local
  53.      t: TYPE;
  54.       do
  55.      t := type.run_type;
  56.      compile_to_jvm0(t);
  57.      t.jvm_check_class_invariant;
  58.      writable.jvm_assign;
  59.       end;
  60.    
  61.    use_current: BOOLEAN is   
  62.       do
  63.      Result := writable.use_current;
  64.       end;
  65.    
  66.    to_runnable(rc: like run_compound): like Current is
  67.       do
  68.      if run_compound = Void then
  69.         check_writable(rc);
  70.         check_explicit_type;
  71.         check_created_type(type);
  72.         check_creation_clause(type);
  73.         Result := Current;
  74.      else
  75.         !!Result.make(start_position,type,writable);
  76.         Result := Result.to_runnable(rc);
  77.      end;
  78.       end;
  79.    
  80.    pretty_print is
  81.       do
  82.      fmt.put_character('!');
  83.      type.pretty_print;
  84.      fmt.put_character('!');
  85.      writable.pretty_print;
  86.      if fmt.semi_colon_flag then
  87.         fmt.put_character(';');
  88.      end;
  89.       end;
  90.  
  91. invariant
  92.    
  93.    type /= Void;
  94.    
  95.    call = Void;
  96.    
  97.    run_feature = Void;
  98.    
  99. end -- CREATION_CALL_2
  100.  
  101.